Page({
  data: {
    showUrl: "",
    canUse: true,
  },
  onLoad({platform}) {
    let app = getApp()
    app.setShareChannel(platform)
    // 新年换新机
    let time = new Date().getTime()
    this.data.showUrl = `https://www.ddzuji.cn/topic/alipay/h5/newYearReplacePhone/index.html?id=${time}`;
  },
  onMessage(e) {
    const { name } = e.detail
    if(name === '订阅消息') {
      my.requestSubscribeMessage({
        entityIds: [
          '1ad56d038bfe4bfabe91db8dfd703ce5',
        ],
        success: () => {

        },
        fail: (err) => {
          console.log(err, 'err');
        }
      })
    }
    if(name === '跳转分类') {
      my.requestSubscribeMessage({
        entityIds: [
          'b0c7589d65dd4352922e1b6016f0a78d',
          '1ad56d038bfe4bfabe91db8dfd703ce5',
          '366afcf17f424cf0b8d67a93493bae7a'
        ],
        success: () => {
          my.switchTab({
            url: '/page/rent/sorts/sorts'
          })
        },
        fail: () => {
          my.switchTab({
            url: '/page/rent/sorts/sorts'
          })
        }
      })
    }
  }
});
